home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 3545 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.3 KB

  1. Path: news.ios.com!usenet
  2. From: John Leonard <leonardj@tribeca.ios.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: Include file conflicts in BC++ 4.52
  5. Date: Wed, 24 Jan 1996 14:17:36 -0500
  6. Organization: 12th of Nov, Inc
  7. Message-ID: <310685D0.381D@tribeca.ios.com>
  8. NNTP-Posting-Host: ppp-52.ts-9.hck.idt.net
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=us-ascii
  11. Content-Transfer-Encoding: 7bit
  12. X-Mailer: Mozilla 2.0b4 (Win95; I)
  13.  
  14. I am using BC++ 4.52. A program I just compiled included "string.h" and "windowsx.h". Both of 
  15. these files make some common defines:
  16.  
  17. from string.h
  18.  
  19. #if !defined(__STDC__) /* NON_ANSI  */
  20. #define _fmemccpy  memccpy
  21. #define _fmemchr   memchr
  22. #define _fmemcmp   memcmp
  23. #define _fmemcpy   memcpy
  24. #define _fmemicmp  memicmp
  25. ...
  26.  
  27. from windowsx.h
  28.  
  29. #if !defined(__BORLANDC__)
  30.  
  31. #define _ncalloc    calloc
  32. #define _nexpand    _expand
  33. #define _ffree      free
  34. #define _fmalloc    malloc
  35. #define _fmemccpy   _memccpy
  36. #define _fmemchr    memchr
  37. #define _fmemcmp    memcmp
  38. #define _fmemcpy    memcpy
  39. #define _fmemicmp   _memicmp
  40. #define _fmemmove   memmove
  41. #define _fmemset    memset
  42. ...
  43.  
  44.      This produced an error. I tried to change this by routing the compiler around the code block in 
  45. the windowsx file by placing the string "__BORLANDC__" in the defines box in the 
  46. Options/Project/defines dialog. This produced another error relating to a different definition of 
  47. that string i.e. "__BORLANDC__" , in, I think, the "new.h" file. So I removed the __BORLANDC__ from 
  48. the defines list and made the following change to the windowsx file itself:
  49.  
  50. //     #if !defined(__BORLANDC__)
  51. #if 0
  52.  
  53. #define  _ncalloc     calloc
  54. #define  _nexpand    _expand
  55. ...
  56.  
  57.      As far as I can tell this solved the problem and allowed me to build and run the prog. What I 
  58. want to know is, what is the correct way of doing this? Isn't __BORLANDC__ defined automatically by 
  59. the environment, why isn't windowsx.h being routed around that #define block? I mean why should 
  60. including standard header files like string.h and windowsx.h cause a conflict? Earlier I tried 
  61. including, I think it was "user.h", so that my window function could use some API define like 
  62. SW_SHOWDEFAULT and that caused problems. I didn't even want to deal with it. I just copied the 
  63. #define out of the file and into my own source and got it to compile but surely that is not the way 
  64. to do things.
  65.      Thanks,
  66.      John
  67.